using System;
using System.Diagnostics;
using log4net;

namespace Mistral
{
	public class Log
	{
		private static readonly ILog __log = LogManager.GetLogger( typeof(Log) );
		
		public static readonly string CategoryError		= "Error";
		public static readonly string CategoryWarning	= "Warning";
		public static readonly string CategoryInfo		= "Info";
		
		public static void WriteLine( string message )
		{
			//Trace.WriteLine( message );
			__log.Info( message );
		}
		
		public static void WriteLine( string message, string category )
		{
			//Trace.WriteLine( message, category );
			if( category == CategoryInfo )
				__log.Info( message );
			else if( category == CategoryWarning )
				__log.Warn( message );
			else if( category == CategoryError )
				__log.Error( message );
		}
		
		public static void WriteLine( Exception e )
		{
			Error( e.ToString() );
		}
		
		#region Error/Warning/Info

		public static void Error( string message )
		{
			WriteLine( message, CategoryError );
		}
		
		public static void Warning( string message )
		{
			WriteLine( message, CategoryWarning );
		}
		
		public static void Info( string message )
		{
			WriteLine( message, CategoryInfo );
		}

		#endregion

		#region Debug Error/Warning/Info

		[Conditional("DEBUG")]
		public static void DebugError( string message )
		{
			Error( message );
		}
		
		[Conditional("DEBUG")]
		public static void DebugWarning( string message )
		{
			Warning( message );
		}
		
		[Conditional("DEBUG")]
		public static void DebugInfo( string message )
		{
			Info( message );
		}

		#endregion

	}
}
